#include <gwbase/base/string_util.h>
#include <gwbase/base/test_harness.h>

using namespace dicom;

class StringUtilTest { };

TEST(StringUtilTest, LowerString) {
  const std::string s = "ABCDa";
  EXPECT_Eq(LowerString(s), "abcda");
}

TEST(StringUtilTest, InplaceLowerString) {
  std::string s = "ABCDa";
  InplaceLowerString(s);
  EXPECT_Eq(s, "abcda");
}

TEST(StringUtilTest, SplitLines) {
  const std::string s = "key=value\nkey1 = value #comment \nkey2= value\n";
  std::vector<Slice> lines;
  SplitToLines(s, &lines);
  EXPECT_TRUE(lines.size() == 4);
  EXPECT_Eq(lines[0].ToString(), "key=value");
  EXPECT_Eq(lines[1].ToString(), "key1 = value #comment ");
  EXPECT_Eq(lines[2].ToString(), "key2= value");
  EXPECT_Eq(lines[3].ToString(), "");
}

int main() {
  RunAllTests();
}


